package demo1108.demo01;

/**
 * @author JYH
 * @version 1.0
 * @date 2022/11/8 16:21
 */
public class Test01 {
    public static void main(String[] args) {

    }
}
class Singleton{
    private Singleton(){}

    private volatile static Singleton singleton;

    public static Singleton getInstance(){
        if (singleton==null){
            synchronized (Singleton.class){
                if (singleton==null){
                    singleton=new Singleton();
                }
            }
        }
        return singleton;
    }

}